<?php
class ORMProduce extends ORMBase {
  public function __construct() {
    parent::__construct('Produce');
  }

  public function __toEpObject($myManager, $epObject, $object) {
    $epObject->trackId = isset($object->trackId) ? $object->trackId : '';
    $epObject->parent_trackId = isset($object->parent_trackId) ? $object->parent_trackId : '';
    $epObject->cancelled = isset($object->cancelled) ? $object->cancelled : 0;
    $epObject->completed = isset($object->completed) ? $object->completed : 0;
    $epObject->modified = isset($object->modified) ? $object->modified : 0;
    $epObject->branch = isset($object->branch) ? $object->branch : '';
    $epObject->host = isset($object->host) ? $object->host : '';
    $epObject->state = isset($object->state) ? $object->state : 0;
    $epObject->deadline = (isset($object->deadline) && $object->deadline) ? SimpleDate::toStamp($object->deadline) : 0;
    $epObject->title = isset($object->title) ? $object->title : '';
    $epObject->estimates = isset($object->estimates) ? $object->estimates : 0;
    $epObject->extras = isset($object->extras) ? $object->extras : 0;
    $epObject->travels = isset($object->travels) ? $object->travels : 0;
    $epObject->createdDate = (isset($object->createdDate) && $object->createdDate) ? SimpleDate::toStamp($object->createdDate) : 0;
    $epObject->sentDate = (isset($object->sentDate) && $object->sentDate) ? SimpleDate::toStamp($object->sentDate) : 0;
    $epObject->receivedDate = (isset($object->receivedDate) && $object->receivedDate) ? SimpleDate::toStamp($object->receivedDate) : 0;
    $epObject->receiver = isset($object->receiver) ? $object->receiver : '';
    $epObject->address = isset($object->address) ? $object->address : '';
    $epObject->code = isset($object->code) ? $object->code : '';
    $epObject->company = isset($object->company) ? $object->company : '';
    $epObject->weight = isset($object->weight) ? $object->weight : 0;
    $epObject->comment = isset($object->comment) ? $object->comment : '';
    $epObject->review = isset($object->review) ? $object->review : '';
    $epObject->pi_trackId = isset($object->pi_trackId) ? $object->pi_trackId : '';
    $epObject->pi_sampleId = isset($object->pi_sampleId) ? $object->pi_sampleId : 0;
    $epObject->pi_name = isset($object->pi_name) ? $object->pi_name : '';
    $epObject->pi_price = isset($object->pi_price) ? $object->pi_price : 0;
    $epObject->pi_unit = isset($object->pi_unit) ? $object->pi_unit : '';
    $epObject->pi_type = isset($object->pi_type) ? $object->pi_type : '';
    $epObject->pi_model = isset($object->pi_model) ? $object->pi_model : '';
    $epObject->pi_otherId = isset($object->pi_otherId) ? $object->pi_otherId : '';
    $epObject->pi_quantity = isset($object->pi_quantity) ? $object->pi_quantity : 0;
    $epObject->pi_total = isset($object->pi_total) ? $object->pi_total : 0;
    $epObject->pi_packageInc = isset($object->pi_packageInc) ? $object->pi_packageInc : '';
    $epObject->user_trackId = isset($object->user_trackId) ? $object->user_trackId : '';
    $epObject->user_account = isset($object->user_account) ? $object->user_account : '';
    $epObject->user_password = isset($object->user_password) ? $object->user_password : '';
    $epObject->user_name = isset($object->user_name) ? $object->user_name : '';
    $epObject->user_email = isset($object->user_email) ? $object->user_email : '';
    $epObject->user_type = isset($object->user_type) ? $object->user_type : '';
    $epObject->when = (isset($object->when) && $object->when) ? SimpleDate::toStamp($object->when) : 0;
    $epObject->how = isset($object->how) ? $object->how : '';
    $epObject->date = (isset($object->date) && $object->date) ? SimpleDate::toStamp($object->date) : 0;
    $epObject->orderFlag = isset($object->orderFlag) ? $object->orderFlag : '';
    $epObject->orderTrackId = isset($object->orderTrackId) ? $object->orderTrackId : '';
    $epObject->orderId = isset($object->orderId) ? $object->orderId : 0;
    $epObject->customerId = isset($object->customerId) ? $object->customerId : 0;
    $epObject->note = isset($object->note) ? $object->note : '';
    $epObject->owner = isset($object->owner) ? $object->owner : '';
    $epObject->ownerTrackId = isset($object->ownerTrackId) ? $object->ownerTrackId : '';
    $epObject->isCustom = isset($object->isCustom) ? $object->isCustom : 0;
    $epObject->customTask = isset($object->customTask) ? $object->customTask : '';
    $epObject->urgent = isset($object->urgent) ? $object->urgent : 0;
    return $epObject;
  }

  public function __toObject($myManager, $epObject, $object) {
    $object->id = $epObject->oid;
    $object->trackId = $epObject->trackId;
    $object->parent_trackId = $epObject->parent_trackId;
    $object->cancelled = $epObject->cancelled;
    $object->completed = $epObject->completed;
    $object->modified = $epObject->modified;
    $object->branch = $epObject->branch;
    $object->host = $epObject->host;
    $object->state = $epObject->state;
    $object->deadline = ($epObject->deadline != 0) ? SimpleDate::fromStamp($epObject->deadline) : 0;
    $object->title = $epObject->title;
    $object->estimates = $epObject->estimates;
    $object->extras = $epObject->extras;
    $object->travels = $epObject->travels;
    $object->createdDate = ($epObject->createdDate != 0) ? SimpleDate::fromStamp($epObject->createdDate) : 0;
    $object->sentDate = ($epObject->sentDate != 0) ? SimpleDate::fromStamp($epObject->sentDate) : 0;
    $object->receivedDate = ($epObject->receivedDate != 0) ? SimpleDate::fromStamp($epObject->receivedDate) : 0;
    $object->receiver = $epObject->receiver;
    $object->address = $epObject->address;
    $object->code = $epObject->code;
    $object->company = $epObject->company;
    $object->weight = $epObject->weight;
    $object->comment = $epObject->comment;
    $object->review = $epObject->review;
    $object->pi_trackId = $epObject->pi_trackId;
    $object->pi_sampleId = $epObject->pi_sampleId;
    $object->pi_name = $epObject->pi_name;
    $object->pi_price = $epObject->pi_price;
    $object->pi_unit = $epObject->pi_unit;
    $object->pi_type = $epObject->pi_type;
    $object->pi_model = $epObject->pi_model;
    $object->pi_otherId = $epObject->pi_otherId;
    $object->pi_quantity = $epObject->pi_quantity;
    $object->pi_total = $epObject->pi_total;
    $object->pi_packageInc = $epObject->pi_packageInc;
    $object->user_trackId = $epObject->user_trackId;
    $object->user_account = $epObject->user_account;
    $object->user_password = $epObject->user_password;
    $object->user_name = $epObject->user_name;
    $object->user_email = $epObject->user_email;
    $object->user_type = $epObject->user_type;
    $object->when = ($epObject->when != 0) ? SimpleDate::fromStamp($epObject->when) : 0;
    $object->how = $epObject->how;
    $object->date = ($epObject->date != 0) ? SimpleDate::fromStamp($epObject->date) : 0;
    $object->orderFlag = $epObject->orderFlag;
    $object->orderTrackId = $epObject->orderTrackId;
    $object->orderId = $epObject->orderId;
    $object->customerId = $epObject->customerId;
    $object->note = $epObject->note;
    $object->owner = $epObject->owner;
    $object->ownerTrackId = $epObject->ownerTrackId;
    $object->isCustom = $epObject->isCustom;
    $object->customTask = $epObject->customTask;
    $object->urgent = $epObject->urgent;
    return $object;
  }
}
?>
